Skip to content

perf(editor): update highlighters once at the end of a theme transition - #1402

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/1358-theme-transition-highlight
Oct 10, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue/1358-theme-transition-highlight

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Closes #1358

State of the issue

Points 1 and 2 (do not dispose / recreate QueryaHighlightController on each frame, update it in place) were already covered by the controller lifecycle refactor (#1366): the editor now calls controller.updateTheme. What was left is point 3 and the per-frame cost: during a transition QueryaTheme.lerp hands the editor a different editor theme every frame, so each frame ran SyntaxHighlightService.createPair with transient colours: a cache miss, a new highlighter pair, and eviction of real entries from the 12-slot cache.

Change

  • QueryaThemeScope.transitioning (default false) and QueryaThemeScope.isTransitioning(context); updateShouldNotify also fires when the flag flips.
  • AnimatedQueryaTheme sets transitioning: animation.isAnimating.
  • QueryaCodeEditor._syncThemeIfNeeded ignores mid-transition frames (once it has an initial theme) and applies the final theme once, when transitioning becomes false.

Behaviour note

While a transition runs the token colours stay on the old theme and switch once at the end of the 200-300 ms; the editor's base text colour and chrome still interpolate.

Tests

animated_querya_theme_transition_test.dart: the flag is false at rest, true mid-animation, false after, consumers are rebuilt when it ends, and plain scopes default to settled.

Not run locally; CI is the check.

QueryaThemeScope now says whether its theme is a mid-animation frame
(AnimatedQueryaTheme sets it while the controller runs). QueryaCodeEditor
skips highlighter updates for those frames and applies the final theme
once, so a transition no longer builds a highlighter pair per frame or
fills the pair cache with transient colours. Closes #1358.
@github-actions github-actions Bot added theme Theming, colors, VS Code themes editor Code/SQL editor performance Theme parser epic label: performance P2 Medium priority / Parity & Refactoring labels Oct 10, 2026
@github-actions github-actions Bot added this to the Theme system milestone Oct 10, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit d170c9e into dev Oct 10, 2026
13 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/1358-theme-transition-highlight branch October 11, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editor Code/SQL editor P2 Medium priority / Parity & Refactoring performance Theme parser epic label: performance theme Theming, colors, VS Code themes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant